package handler

import (
	"im_sys/apps/im/ws/internal/handler/conversation"
	"im_sys/apps/im/ws/internal/handler/msg_push"
	"im_sys/apps/im/ws/internal/handler/user"
	"im_sys/apps/im/ws/internal/svc"
	"im_sys/apps/im/ws/ws_server"
)

func RegisterHandlers(server *ws_server.Server, serverCtx *svc.ServiceContext) {
	server.AddRoutes(
		[]ws_server.Route{
			{
				// 用户上线
				Method:  "user.online",
				Handler: user.OnLine(serverCtx),
			},
			{
				// 私聊
				Method:  "conversation.chat",
				Handler: conversation.Chat(serverCtx),
			},
			{
				// 发送方通过websocket将消息推入kafka
				Method:  "msg.push",
				Handler: msg_push.PushToReceiver(serverCtx),
			},
		},
	)
}
